<template>
  <div id="contentBox">
    <div class="searchBox">
      <el-form :inline="true" ref="searchForm" :model="searchForm" label-width="96px">
        <el-form-item label="注册日期起" prop="startDate">
          <el-date-picker :editable="false" v-model="searchForm.startDate" type="date" placeholder="选择日期" :picker-options="startDateOpt"
            @change="debounceSeach">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="注册日期止" prop="endDate">
          <el-date-picker :editable="false" v-model="searchForm.endDate" type="date" placeholder="选择日期" :picker-options="endDateOpt"
            @change="debounceSeach">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="使用者姓名" prop="person">
          <el-input v-model="searchForm.person" placeholder="请输入搜索内容..." @input.native="debounceSeach"></el-input>
        </el-form-item>
        <el-form-item label="手机号码" prop="phone">
          <el-input v-model="searchForm.phone" placeholder="请输入搜索内容..." @input.native="debounceSeach"></el-input>
        </el-form-item>
        <el-form-item label="手机号归属省市" prop="searchCity">
          <el-input v-model="searchForm.searchCity" placeholder="请输入搜索内容..." @input.native="debounceSeach">
          </el-input>
        </el-form-item>
        <el-form-item label="实名认证日期起" prop="realNameAuthStartDate">
          <el-date-picker :editable="false" v-model="searchForm.realNameAuthStartDate" type="date" placeholder="选择日期" :picker-options="startDateOpt"
            @change="debounceSeach">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="实名认证日期止" prop="realNameAuthEndDate">
          <el-date-picker :editable="false" v-model="searchForm.realNameAuthEndDate" type="date" placeholder="选择日期" :picker-options="endDateOpt"
            @change="debounceSeach">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="实名认证资料有无" prop="realNameIsData">
          <el-select v-model="searchForm.realNameIsData" placeholder="请选择" @change="debounceSeach">
            <el-option label="请选择实名认证资料" value=""></el-option>
            <el-option v-for="(item, index) in dealerData" :label="item" :value="index" :key="index"></el-option>
          </el-select>
        </el-form-item>


       <!--  <el-form-item label="实名认证状态" prop="realNameStatus">
         <el-select v-model="searchForm.realNameStatus" placeholder="请选择状态" @change="debounceSeach">
           <el-option label="请选择实名认证" value=""></el-option>
           <el-option v-for="(item, index) in statusMap" :label="item" :value="index" :key="index">
           </el-option>
         </el-select>
       </el-form-item> -->
<!-- 
        <el-form-item label="实名认证状态" prop="realNameStatus">
          <el-select v-model="searchForm.realNameStatus" placeholder="请选择状态" @change="debounceSeach" @input="deleteValue('realNameStatus')">
            <el-option label="请选择实名认证" value=""></el-option>
            <el-option v-for="(item, index) in statusMap" :label="item" :value="index" :key="index">
            </el-option>
          </el-select>
        </el-form-item> -->



        <el-form-item label="用户来源" prop="source">
          <el-select v-model="searchForm.source" placeholder="请选择状态" @change="debounceSeach">
            <el-option label="请选择用户来源" value=""></el-option>
            <el-option v-for="(item, index) in dealerSource" :label="item" :value="index" :key="index">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="企业认证日期起" prop="authStartDate">
          <el-date-picker :editable="false" v-model="searchForm.authStartDate" type="date" placeholder="选择日期" :picker-options="startDateOpt"
            @change="debounceSeach">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="企业认证日期止" prop="authEndDate">
          <el-date-picker :editable="false" v-model="searchForm.authEndDate" type="date" placeholder="选择日期" :picker-options="endDateOpt"
            @change="debounceSeach">
          </el-date-picker>
        </el-form-item>

        <el-form-item label="企业认证资料有无" prop="isData">
          <el-select v-model="searchForm.isData" placeholder="请选择" @change="debounceSeach">
            <el-option label="请选择企业认证资料" value=""></el-option>
            <el-option v-for="(item, index) in dealerData" :label="item" :value="index" :key="index"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="认证状态" prop="status">
          <el-select v-model="searchForm.status" placeholder="请选择状态" @change="debounceSeach">
            <el-option label="请选择认证状态" value=""></el-option>
            <el-option v-for="(item, index) in statusMap" :label="item" :value="index" :key="index">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="认证经销商" prop="name">
          <el-input v-model="searchForm.name" placeholder="请输入搜索内容..." @input.native="debounceSeach">
          </el-input>
     
        </el-form-item>

        <el-form-item label="业务员" prop="realname">
          <el-input v-model="searchForm.realname" placeholder="请输入搜索内容..." @input.native="debounceSeach">
          </el-input>
        </el-form-item>

        <el-form-item label="经销商类型" prop="type">
          <el-select v-model="searchForm.type" placeholder="请选择" @change="debounceSeach">
            <el-option label="请选择经销商类型" value=""></el-option>
            <el-option v-for="(item, index) in type" :label="item" :value="index" :key="index"></el-option>
          </el-select>
        </el-form-item>

          <el-form-item label="经销商类别" prop="category">
          <el-select v-model="searchForm.category" placeholder="请选择" @change="debounceSeach">
            <el-option label="请选择经销商类别" value=""></el-option>
            <el-option v-for="(item, index) in category" :label="item" :value="index" :key="index"></el-option>
          </el-select>
        </el-form-item>

          <el-form-item label="所属经销商" prop="dealerCompanyName">
          <el-input v-model="searchForm.dealerCompanyName" placeholder="请输入搜索内容..." @input.native="debounceSeach">
          </el-input>
        </el-form-item>

        <el-form-item label="是否启用" prop="enable">
          <el-select v-model="searchForm.enable" placeholder="请选择" @change="debounceSeach">
            <el-option label="请选择否启用" value=""></el-option>
            <el-option v-for="(item, index) in dealerEnable" :label="item" :value="index" :key="index"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item style="    margin-bottom: 10px;">
          <el-button @click="resetSearchForm('searchForm')">重置</el-button>
          	<el-button @click="exportExcels(searchForm,'dealer_ordinary/export','普通用户管理')">导出</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div id="tableBox" style="margin:0 25px;">
      <el-table :data="tableData.data" border id='table' >
        <el-table-column label="认证经销商" :min-width="250" fixed='left'>
          <template scope="scope">
            <span>{{ scope.row.name }}</span>
          </template>
        </el-table-column>

        <el-table-column label="使用者姓名" width="120">
          <template scope="scope">
            <span>{{ scope.row.person }}</span>
          </template>
        </el-table-column>
        <el-table-column label="使用者手机号" width="120">
          <template scope="scope">
            <span>{{ scope.row.phone }}</span>
          </template>
        </el-table-column>
        <el-table-column label="手机号码归属省市" width="160">
          <template scope="scope">
            <span>{{ scope.row.searchCity }}</span>
          </template>
        </el-table-column>
        <el-table-column label="用户来源" width="100">
          <template scope="scope">
            <span v-for="(index, item) in scope.row.dealerSourceVO" :key='item'>{{ item }}</span>
          </template>
        </el-table-column>
        <el-table-column label="注册时间" width="160">
          <template scope="scope">
            <span>{{ scope.row.addDate | parseTime }}</span>
          </template>
        </el-table-column>
        <el-table-column label="实名认证资料有无" width="100">
          <template scope="scope">
            <span>{{ scope.row.realNameIsData|showHaveOrNo }}</span>
          </template>
        </el-table-column>

       <!--  <el-table-column label="实名认证状态" width="100">
         <template scope="scope">
           <span>{{ scope.row.realNameStatusString }}</span>
         </template>
       </el-table-column> -->
        <el-table-column label="实名认证时间" width="160">
          <template scope="scope">
            <span>{{ scope.row.realNameAuthenticationTime | parseTime }}</span>
          </template>
        </el-table-column>
        <el-table-column label="企业认证资料有无" width="100">
          <template scope="scope">
            <span>{{ scope.row.isData|showHaveOrNo }}</span>
          </template>
        </el-table-column>

       <!--  <el-table-column label="企业认证状态" width="100">
         <template scope="scope">
           <span>{{ scope.row.statusString }}</span>
         </template>
       </el-table-column> -->
        <el-table-column label="企业认证时间" width="160">
          <template scope="scope">
            <span>{{ scope.row.authenticationTime | parseTime }}</span>
          </template>
        </el-table-column>

     <el-table-column label="认证状态" width="100">
          <template scope="scope">
            <span>{{ scope.row.statusString }}</span>
          </template>
        </el-table-column>

        <el-table-column label="业务员" width="100">
          <template scope="scope">
            <span>{{ scope.row.realname }}</span>
          </template>
        </el-table-column>

        <el-table-column label="经销商类型" :width="100">
          <template scope="scope">
            <span v-for="(index, item) in scope.row.dealerTypeVO" :key='item'>{{ item }}</span>
          </template>
        </el-table-column>
        <el-table-column label="经销商类别" :width="100">
          <template scope="scope">
            <span v-for="(index, item) in scope.row.dealerCategoryVO" :key='item'>{{ item }}</span>
          </template>
        </el-table-column>
        <el-table-column label="归属经销商" :width="200">
          <template scope="scope">
            <span>{{ scope.row.dealerCompanyName }}</span>
          </template>
        </el-table-column>
        <el-table-column label="是否启用" width="100">
          <template scope="scope">
            <span>{{ scope.row.enable |flagF }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="220" fixed='right'>
          <template scope="scope">
            <el-button style="margin-left:0;" size="small" @click="handleBasic(scope.row)">编辑</el-button>
            <!-- <el-button style="margin-left:0;" size="small" @click="handleSupple(scope.$index, scope.row,true)">添加补充资料</el-button> -->
            <el-button style="margin-left:0;" size="small"
             @click="handleOneself(scope.$index, scope.row,true)"
               v-if="scope.row.status==3"
             >实名认证</el-button>
            <el-button style="margin-left:0;" size="small" 
            @click="handleAuth(scope.$index, scope.row,true)"
              v-if="scope.row.status==7"
            >企业认证</el-button>
            <el-button style="margin-left:0;" size="small" @click="handleDisable(scope.$index, scope.row)" ref="flag"> {{scope.row.enable | flag }}</el-button>
            <el-button style="margin-left:0;" size="small" @click="handleSee(scope.$index, scope.row ,false )">查看</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-dialog title="基本资料管理" v-if="basicDialogFormVisible.dialogFormVisible" :visible.sync="basicDialogFormVisible.dialogFormVisible"
        :lock-scroll='true' top=5% :close-on-click-modal="false">
        <editPopup @Refresh="seachData()" :basicDialogFormVisible="basicDialogFormVisible" ></editPopup>
      </el-dialog>
      <el-dialog title="补充资料管理" v-if="suppleDialogFormVisible.dialogFormVisible" :visible.sync="suppleDialogFormVisible.dialogFormVisible"
        :lock-scroll='true' top=5% :close-on-click-modal="false">
        <suppleDialogForm v-on:refreshTableData="seachData()" v-bind:suppleDialogFormVisible="suppleDialogFormVisible" :tableData="tableData"></suppleDialogForm>
      </el-dialog>
      <el-dialog title="认证资料管理" v-if="authDialogFormVisible.dialogFormVisible" :visible.sync="authDialogFormVisible.dialogFormVisible"
        :lock-scroll='true' top=5% :close-on-click-modal="false">
        <authDialogForm @Refresh="seachData()" v-bind:authDialogFormVisible="authDialogFormVisible" :tableData="tableData"></authDialogForm>
      </el-dialog>
			<el-dialog title="实名认证管理" v-if="oneselfProveFormVisible.dialogFormVisible" :visible.sync="oneselfProveFormVisible.dialogFormVisible"
        :lock-scroll='true' top=5% :close-on-click-modal="false">
        <oneselfProve @Refresh="seachData()" v-bind:oneselfProveFormVisible="oneselfProveFormVisible" ></oneselfProve>
      </el-dialog>
			
    </div>
 
    <div class="block" style="text-align: center;margin-top: 15px;position:relative;">
      <pagination v-on:refreshSeachData="seachData" :tableData="tableData" :searchForm="searchForm"></pagination>
      <el-button style="position: absolute;right: 150px;top: 0px;" type="primary" @click="handleBasic()">添加普通用户</el-button>
    </div>
  </div>
</template>
<script src="./index.js">


</script>
<style scoped lang="stylus" rel="styleheet/stylus">
  @import './index.styl';

</style>
